From 0883cc63a18a28af2dbf10b3167ddd182a3611e0 Mon Sep 17 00:00:00 2001 From: Ewan Mellor Date: Fri, 22 Dec 2006 11:49:19 +0000 Subject: [PATCH] Fix description of ErrorDescription to be all strings, and update the examples. Signed-off-by: Ewan Mellor --- docs/xen-api/wire-protocol.tex | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/docs/xen-api/wire-protocol.tex b/docs/xen-api/wire-protocol.tex index 5b15573809..97604bb4c7 100644 --- a/docs/xen-api/wire-protocol.tex +++ b/docs/xen-api/wire-protocol.tex @@ -105,11 +105,13 @@ In the case where {\tt Status} is set to {\tt Failure} then the struct contains a second element named {\tt ErrorDescription}: \begin{itemize} \item The element of the struct named {\tt ErrorDescription} contains -an array of string values. The first element of the array is an XML-RPC 32-bit {\tt i4} and represents an error code; -the remainder of the array are strings representing error parameters relating to that code. +an array of string values. The first element of the array is an error code; +the remainder of the array are strings representing error parameters relating +to that code. \end{itemize} -For example, an XML-RPC return value from the {\tt Host.ListAllVMs} function above +For example, an XML-RPC return value from the {\tt host.get_resident_VMs} +function above may look like this: \begin{verbatim} @@ -122,9 +124,9 @@ may look like this: - vm-id-1 - vm-id-2 - vm-id-3 + 81547a35-205c-a551-c577-00b982c5fe00 + 61c85a22-05da-b8a2-2e55-06b0847da503 + 1d401ec4-3c17-35a6-fc79-cee6bd9811fe @@ -214,10 +216,12 @@ Create a python object referencing the remote server: >>> xen = xmlrpclib.Server("http://test:4464") \end{verbatim} -Acquire a session token by logging in with a username and password (error-handling ommitted for brevity; the session token is pointed to by the key {\tt 'Value'} in the returned dictionary) +Acquire a session token by logging in with a username and password +(error-handling ommitted for brevity; the session token is pointed to by the +key {\tt 'Value'} in the returned dictionary) \begin{verbatim} ->>> session = xen.Session.do_login_with_password("user", "passwd")['Value'] +>>> session = session.login_with_password("user", "passwd")['Value'] \end{verbatim} When serialised, this call looks like the following: @@ -225,7 +229,7 @@ When serialised, this call looks like the following: \begin{verbatim} - Session.do_login_with_password + session.login_with_password user @@ -237,10 +241,11 @@ When serialised, this call looks like the following: \end{verbatim} -Next, the user may acquire a list of all the VMs known to the host: (Note the call takes the session token as the only parameter) +Next, the user may acquire a list of all the VMs known to the host: (Note the +call takes the session token as the only parameter) \begin{verbatim} ->>> all_vms = xen.VM.do_list(session)['Value'] +>>> all_vms = host.get_resident_VMs(session)['Value'] >>> all_vms ['b7b92d9e-d442-4710-92a5-ab039fd7d89b', '23e1e837-abbf-4675-b077-d4007989b0cc', '2045dbc0-0734-4eea-9cb2-b8218c6b5bf2', '3202ae18-a046-4c32-9fda-e32e9631866e'] @@ -249,15 +254,15 @@ Next, the user may acquire a list of all the VMs known to the host: (Note the ca Note the VM references are internally UUIDs. Once a reference to a VM has been acquired a lifecycle operation may be invoked: \begin{verbatim} ->>> xen.VM.do_start(session, all_vms[3], False) +>>> xen.VM.start(session, all_vms[3], False) {'Status': 'Failure', 'ErrorDescription': 'Operation not implemented'} \end{verbatim} In this case the {\tt start} message has not been implemented and an error response has been returned. Currently these high-level errors are returned as structured data (rather than as XMLRPC faults), allowing for internationalised errors in future. Finally, here are some examples of using accessors for object fields: \begin{verbatim} ->>> xen.VM.getname_label(session, all_vms[3])['Value'] +>>> xen.VM.get_name_label(session, all_vms[3])['Value'] 'SMP' ->>> xen.VM.getname_description(session, all_vms[3])['Value'] +>>> xen.VM.get_name_description(session, all_vms[3])['Value'] 'Debian for Xen' \end{verbatim} -- 2.30.2